﻿using System;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using OfficeOpenXml.Table;
using SqlSugar;

namespace NP.BPMReportPlatform.ZH.Dto
{
    [ExcelExporter(Name = "生产单更改审批流程", TableStyle = TableStyles.Light10, AutoFitAllColumn = true)]
    public class GetPOCAPOutput
    {
        /// <summary>
        /// 流程状态
        /// </summary>
        [ExporterHeader(DisplayName = "流程状态")]
        public string OrderStatus { get; set; }

        /// <summary>
        /// 工单号
        /// </summary>
        [ExporterHeader(DisplayName = "工单号")]
        public string InstanceNumber { get; set; }

        /// <summary>
        /// 申请时间
        /// </summary>
        [ExporterHeader(DisplayName = "申请时间")]
        public string CreateTime { get; set; }

        /// <summary>
        /// 申请时间
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public DateTime? CreateDateTime { get; set; }

        /// <summary>
        /// 申请人
        /// </summary>
        [ExporterHeader(DisplayName = "申请人")]
        public string AddUserName { get; set; }

        /// <summary>
        /// 单据详情链接
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string Url { get; set; }

        /// <summary>
        /// PWS号
        /// </summary>
        [ExporterHeader(DisplayName = "PWS号")]
        public string PWSCode { get; set; }

        /// <summary>
        /// 工厂
        /// </summary>
        [ExporterHeader(DisplayName = "工厂")]
        public string Factory { get; set; }

        /// <summary>
        /// 项目
        /// </summary>
        [ExporterHeader(DisplayName = "项目")]
        public string ProductCode { get; set; }

        /// <summary>
        /// 物料编码
        /// </summary>
        [ExporterHeader(DisplayName = "物料")]
        public string MaterialCode { get; set; }

        /// <summary>
        /// 物料描述
        /// </summary>
        [ExporterHeader(DisplayName = "物料描述")]
        public string MaterialName { get; set; }

        /// <summary>
        /// 批号
        /// </summary>
        [ExporterHeader(DisplayName = "批号")]
        public string LotNumber { get; set; }

        /// <summary>
        /// 原组件
        /// </summary>
        [ExporterHeader(DisplayName = "原组件")]
        public string OriginalAssembly { get; set; }

        /// <summary>
        /// 原组件描述
        /// </summary>
        [ExporterHeader(DisplayName = "原组件描述")]
        public string OriginalDescribe { get; set; }

        /// <summary>
        /// 组件
        /// </summary>
        [ExporterHeader(DisplayName = "组件")]
        public string Assembly { get; set; }

        /// <summary>
        /// 组件描述
        /// </summary>
        [ExporterHeader(DisplayName = "组件描述")]
        public string Describe { get; set; }

        /// <summary>
        /// 原始数量
        /// </summary>
        [ExporterHeader(DisplayName = "原始数量")]
        public string OriginalNumber { get; set; }

        /// <summary>
        /// 调整数量
        /// </summary>
        [ExporterHeader(DisplayName = "调整数量")]
        public string AdjustNumber { get; set; }

        /// <summary>
        /// 调整后数量
        /// </summary>
        [ExporterHeader(DisplayName = "调整后数量")]
        public string AdjustedNumber { get; set; }

        /// <summary>
        /// 计量单位
        /// </summary>
        [ExporterHeader(DisplayName = "计量单位")]
        public string Unit { get; set; }

        /// <summary>
        /// 工序
        /// </summary>
        [ExporterHeader(DisplayName = "工序")]
        public string WorkProcedure { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [ExporterHeader(DisplayName = "备注")]
        public string Remark { get; set; }

        /// <summary>
        /// 需求量
        /// </summary>
        [ExporterHeader(DisplayName = "需求量")]
        public string Requirement { get; set; }

        ///// <summary>
        ///// 替代组
        ///// </summary>
        //public string OverrideGroup { get; set; }

        /// <summary>
        /// 替代百分比
        /// </summary>
        [ExporterHeader(DisplayName = "替代百分比")]
        public string Percentage { get; set; }

        ///// <summary>
        ///// 同步结果
        ///// </summary>
        //public bool SyncResult { get; set; }

        ///// <summary>
        ///// 同步信息
        ///// </summary>
        //public string Message { get; set; }

        /// <summary>
        /// 申请人备注
        /// </summary>
        [ExporterHeader(DisplayName = "申请人备注")]
        public string ApplyRemark { get; set; }

        /// <summary>
        /// 审批人备注
        /// </summary>
        [ExporterHeader(DisplayName = "审批人备注")]
        public string ApprovalRemark { get; set; }

        /// <summary>
        /// 审批通过时间
        /// </summary>
        [ExporterHeader(DisplayName = "审批通过时间")]
        public string ApprovedTime { get; set; }

        /// <summary>
        /// 周期
        /// </summary>
        [ExporterHeader(DisplayName = "周期(h)")]
        public string Cycle { get; set; }

        /// <summary>
        /// 同步结果
        /// </summary>
        [ExporterHeader(DisplayName = "同步结果")]
        public string SyncResult { get; set; }
        /// <summary>
        /// 失败原因
        /// </summary>
        [ExporterHeader(DisplayName = "失败原因")]
        public string SyncError { get; set; }

        /// <summary>
        /// 审批通过时间
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public DateTime? FinishTime { get; set; }
        /// <summary>
        /// 流程开始时间
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public DateTime StartTime { get; set; }



        /// <summary>
        /// 1单行模式，2带出子项模式 3批量模式
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public int? FormMode { get; set; }

        /// <summary>
        /// 批量修改的单据
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string BatchPwsCode { get; set; }

        /// <summary>
        /// PWS单批量
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string BatchNumber { get; set; }

        /// <summary>
        /// PWS单批量（新）
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string NewBatchNumber { get; set; }


        /// <summary>
        /// 输入数量
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string InputNumber { get; set; }

        /// <summary>
        /// 最终数量
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string CalcNumber { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string ItemUnit { get; set; }

        /// <summary>
        /// 库位
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string StorageLocation { get; set; }

        /// <summary>
        /// 组件批次
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string ItemBatch { get; set; }

        /// <summary>
        /// 1 原组件，2 新增原组件 3新增固定组件
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string ItemType { get; set; }

        /// <summary>
        /// 1 数量锁定
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string AssemblyType { get; set; }

        /// <summary>
        /// 最终数量之和
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string TotalNumber { get; set; }
    }


    [ExcelExporter(Name = "生产单更改审批流程", TableStyle = TableStyles.Light10, AutoFitAllColumn = true)]
    public class GetPWSCodePOCAPOutput
    {
        /// <summary>
        /// 生产单号
        /// </summary>
        [ExporterHeader(DisplayName = "生产单号")]
        public string PWSCode { get; set; }

        /// <summary>
        /// 工厂
        /// </summary>
        [ExporterHeader(DisplayName = "工厂")]
        public string Factory { get; set; }

        /// <summary>
        /// 物料号
        /// </summary>
        [ExporterHeader(DisplayName = "物料号")]
        public string MaterialCode { get; set; }

        /// <summary>
        /// 物料描述
        /// </summary>
        [ExporterHeader(DisplayName = "物料描述")]
        public string MaterialName { get; set; }

        /// <summary>
        /// 申请人
        /// </summary>
        [ExporterHeader(DisplayName = "申请人")]
        public string AddUser { get; set; }

        /// <summary>
        /// 第一次申请时间
        /// </summary>
        [ExporterHeader(DisplayName = "第一次申请时间")]
        public string AddTime { get; set; }

        [IEIgnore(IsExportIgnore = true)]
        public DateTime AddDateTime { get; set; }

        /// <summary>
        /// 最后通过时间（最终修改结果为成功的时间）
        /// </summary>
        [ExporterHeader(DisplayName = "最后通过时间")]
        public string FinishTime { get; set; }

        [IEIgnore(IsExportIgnore = true)]
        public DateTime? FinishDateTime { get; set; }

        /// <summary>
        /// 历时
        /// </summary>
        [ExporterHeader(DisplayName = "历时")]
        public double? DueTime { get; set; }

        /// <summary>
        /// 最新修改结果（取BPM单据审批通过时间最靠后的一次修改结果） 
        /// </summary>
        [ExporterHeader(DisplayName = "最新修改结果")]
        public string LastResult { get; set; }

        /// <summary>
        /// 申请次数（存在某个PWS单的BPM单据的数量）
        /// </summary>
        [ExporterHeader(DisplayName = "申请次数")]
        public int RequestCount { get; set; } = 0;

        /// <summary>
        /// 流程单号
        /// </summary>
        [ExporterHeader(DisplayName = "流程单号")]
        public string InstanceNumber { get; set; }

        /// <summary>
        /// 流程状态
        /// </summary>
        [ExporterHeader(DisplayName = "流程状态")]
        public string InstanceStatus { get; set; }

        /// <summary>
        /// 单据详情链接
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string Url { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        public string InstanceStatusCode { get; set; }
    }
}